<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">

				<!--<el-form-item>-->
					<!--<el-input v-model="filters.schoolstatus" placeholder="学校名称"></el-input>-->
				<!--</el-form-item>-->
				<!--<el-form-item label="学校状态"  >-->
					<!--<el-select v-model="filters.schoolstatus" placeholder="请选择学校状态" >-->
						<!--<el-option value="0" label="全部">全部</el-option>-->
						<!--<el-option value="1" label="全部">未使用</el-option>-->
						<!--<el-option value="2" label="全部">已使用</el-option>-->
					<!--</el-select>-->
				<!--</el-form-item>-->
				<el-form-item>
					<el-button type="primary" v-on:click="findPageMobileAccount">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>
		<!--列表-->
		<template>
			<el-table :data="mobileaccounts" highlight-current-row v-loading="loading" border max-height="620" style="width: 100%;">
				<el-table-column type="index" width="80" label="编号">
				</el-table-column>
				<el-table-column prop="account" label="充值账号" >
				</el-table-column>
				<el-table-column prop="password" label="密码"   >
				</el-table-column>
				<el-table-column prop="isStop" label="状态" :formatter="formatStatus" >
				</el-table-column>
				<el-table-column prop="restrictNum" label="充值数量限制"   >
				</el-table-column>
			</el-table>
		</template>
		<el-pagination
				@current-change="handleCurrentChange"
				@size-change="handleSizeChange"
				layout="total,sizes,prev, pager, next"
				:total="total">
		</el-pagination>
	</section>

</template>
<script>
	import { findPageMobileAccount} from '../../api/api';
	export default {
		data() {
			return {
				filters: {
                    schoolstatus: '',
                    schoolname:''
				},
				start:0,
				pageSize:10,
                total:0,
				loading: false,
                mobileaccounts: [],
			}
		},
		methods: {
            formatStatus: function (row, column) {
                return row.isStop === 1 ? '已经使用' : row.isStop === 0 ? '未使用' : "使用中";//1 已经使用 0未使用 2 使用中
            },
            findPageMobileAccount: function () {
				let para = {
					start:this.start,
					pageSize:this.pageSize
				};
				this.loading = true;
                findPageMobileAccount(para).then(datas => {
                    this.loading = false;
                    let { message, code, data } = datas;
                    if (code !== "0") {
                        this.$message({
                            message: message,
                            type: 'error'
                        });
                    } else {
                        this.mobileaccounts = data.result;
                        this.total = data.totalCount;
                    }
                }).catch(e =>{

				});
			},
			handleCurrentChange:function(val){
                this.start = val - 1;
                this.findPageMobileAccount();
			},
            handleSizeChange:function(val){
			    this.pageSize = val;
			    this.findPageMobileAccount();
			}
		},
		mounted() {
			this.findPageMobileAccount();
		}
	};

</script>

<style scoped>

</style>
